<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="d1">这是div</div>
<span>这是span</span>
<input type="text" id="i1">
<input type="button" value="按钮" onclick="fn()">
<script>
    function fn(){
        //得到文本框对象
        let i=document.querySelector("#i1");
        //获取文本框的值
        alert(i.value);
    }
    let d=document.querySelector("#d1");
//    修改元素的文本内容
    d.innerText="div被修改了";
    let  s= document.querySelector("span");
    s.innerText="span也被改了";
</script>
</body>
</html>